package com.service.hibernate.dao;


import java.util.ArrayList;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;

//import com.service.hibernate.pojos.ServiceUses;



public class ServiceUsesDAO {
	
	@SessionTarget
	Session session;
	
	@TransactionTarget
	Transaction transaction;
	
	
	/*public List<ServiceUses> getService(int id){
		List<ServiceUses> sr=new ArrayList<ServiceUses>();
		try {
			System.out.println("Input id is "+id);
			String query="FROM service_uses where service_id="+id;
//		String query="FROM service_uses where service_id=1";
			sr=session.createQuery(query).list();
		} catch (Exception e) {
			System.out.println("Error in ServiceUsesDAO - getServices() :");
			e.printStackTrace();
		}
		return sr;
	}
	public String addCart(ServiceUses srv){
		try{
			
		session.save(srv);
		return "success";
		}
		catch (Exception e) {
			transaction.rollback();
			System.out.println("----------------------------------------------------------------------------------------------------");
			System.out.println("Error in adding data.Transaction is not comitted to the database");
			e.printStackTrace();
			System.out.println("----------------------------------------------------------------------------------------------------");
		}
		return "error";
	}*/
	
}
